package com.web.mall.service.impl;

import com.web.mall.document.EsGoods;
import com.web.mall.mapper.TbGoodsMapper;
import com.web.mall.pojo.TbGoods;
import com.web.mall.repository.EsGoodsRepository;
import com.web.mall.service.EsGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

@Service
public class EsGoodsServiceImpl implements EsGoodsService {

    @Autowired
    private EsGoodsRepository esGoodsRepository;

    @Override
    public Page<EsGoods> queryEsItemByKey(String key, Pageable pageable) {
        return esGoodsRepository.findByKeyword(key,pageable);
    }

    @Override
    public EsGoods findEsItemById(Long goods_id) {
        return esGoodsRepository.findById(goods_id).get();
    }
}
